package com.sky.config;

import com.sky.properties.OssProperties;
import com.sky.utils.OssUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class OssConfig {

    // 插入bean时，可以在入参处，接受ioc容器中已存在的bean
    @Bean
    public OssUtils ossUtils(OssProperties ossProperties){
        log.info("注入 OssUtils Bean {}",ossProperties);
        OssUtils ossUtils = new OssUtils(ossProperties.getEndpoint(),ossProperties.getAccessKeyId(),ossProperties.getAccessKeySecret(),ossProperties.getBucketName());
        return ossUtils;
    }
}
